package com.ruoyi.project.business.controlcenter.iot.enums;

public enum IotEventEnum {
    GATEWAY_RESTART (1001, "网关重启"),
    PLUG_ONOFF(1002, "开关on off"),
    BIND_DEVICE(1003, "网关绑定设备"),
    UNBIND_DEVICE(1004, "设备解绑")
    ;

    private Integer code;
    private String desc;

    IotEventEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 根据键值码返回任务类型枚举
     * @param code 键值码
     * @return 任务类型枚举
     */
    public static IotEventEnum getEnumByCode(Integer code) {

        if (code == null) {
            return null;
        }

        for (IotEventEnum each : values()) {
            if (each.getCode().equals(code)) {
                return each;
            }
        }

        return null;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
